#!/usr/bin/env node

const Koa = require('koa');
const log = console.log;
const logger = require('koa-logger');
const Router = require('koa-router');
const app = new Koa();
const router = new Router();
app.listen(8080);

app.use(logger());

router.get('/authors/', (ctx, next) => {
    log('查询漫画书作者列表');
    ctx.body = '查询成功';
})
router.get('/authors/:authorName', (ctx, next) => {
    log('查询漫画书作者 by name');
    ctx.body = '查询成功';
});
router.post('/authors/', (ctx, next) => {
    log('添加漫画书作者');
    ctx.body = '添加成功';
});
router.put('/authors/:id', (ctx, next) => {
    log('修改漫画书作者');
    ctx.body = '修改成功';
});
router.delete('/authors/:id', (ctx, next) => {
    log('删除漫画书作者');
    ctx.body = '删除成功';
});

app.use(router.routes());